#include <QApplication>
#include <QtGui>

#include "utils/log_manager.h"
#include "utils/utils_log.h"
#include "utils/version.h"
#include "view/main_window.h"

using namespace camera_calibration;

int main(int argc, char **argv) {
  QApplication app(argc, argv);
  // ros 初始化
  ros::init(argc, argv, "camera_calibration_studio");
  // 初始化log
  std::string log_root_path =
      std::string(getenv("HOME")) + std::string("/.camera_calibration/logs");
  LogManager::GetInstance()->Init(log_root_path);

  std::string log_path =
      LogManager::GetInstance()->GetLogPath() + "/dangkang_application.log";
  loguru::add_file(log_path.c_str(), loguru::Append, loguru::Verbosity_MAX);

  std::string msl_version = std::string(PROJECT_VERSION);
  AINFO_F("Project-Template Project Version  < %s > ", msl_version.c_str());

  MainWindow w;
  w.show();
  app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
  int result = app.exec();

  return result;
}
